## divEg.asm
## 
## Program to calculate (4x^2-16)/(2x+5)
##
## Register Use:
##  $1    base register address
##  $2    x
##  $3    Temporary Values
##  $4    value of polynomial A, then quotent of Poly A/Poly B
##  $5    value of polynomial B, then remainder of Poly A/Poly B

        .text
        .globl  main

main: 
        lui   $1,0x1000     #  Init base register
        lw    $2,0($1)      #  Load x
        ori   $3,$0,4       #  load 4 into register
        mult  $2,$3         #  4x
        mflo  $3            #  assume 32 bit result
        mult  $3,$2         #  multipies registers
        mflo  $3            #  puts product in register
        ori   $4,$0,16      #  puts 16 into register
        subu  $4,$3,$4      #  subtract registers 4 and 3, and put into register 4
        ori   $3,$0,2       #  puts 2 into register 3
        mult  $2,$3         #  mutiplies registers
        mflo  $3            #  put product in register
        ori   $5,$0,5       #  puts 5 into register 5
        addu  $5,$3,$5      #  adds up register 3 and 5.
        div   $4,$5         #  divides registers
        mflo  $4            #  puts quotient into register 4
        mfhi  $5            #  puts remainder into register 5

        .data
x:      .word   3           #  Edit this line to change the value of x

## End of file
